package com.ssm.service.impl;

import com.ssm.mapper.ScoreMapper;
import com.ssm.pojo.Score;
import com.ssm.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private ScoreMapper scoreMapper;

    @Override
    @Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED)
    public List<Score> selectAll() {
        System.out.println("oOOOo");
        return scoreMapper.selectAll();
    }

    @Override
    public Score selectById(int id) {
        return scoreMapper.selectById(id);
    }

    @Override
    public int insertOneData(Score score) {
        return scoreMapper.insertOneData(score);
    }

    @Override
    public void deleteById(int id) {
        scoreMapper.deleteById(id);
    }

    @Override
    @Transactional(isolation = Isolation.DEFAULT,propagation = Propagation.REQUIRED)
    public int updateById(int score, int id) {
        int i = scoreMapper.updateById(score, id);
        return i;
    }
}
